home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 10 / AACD 10.iso / AACD / Games / MAME / src / drivers / astrof.c < prev    next >
C/C++ Source or Header  |  2000-04-04  |  13KB  |  357 lines

  1. /*
  2.     Driver For DECO   ASTRO FIGHTER/TOMAHAWK 777
  3.  
  4.     Initial Version
  5.  
  6.     Lee Taylor 28/11/1997
  7.  
  8.  
  9.     Astro Fighter Sets:
  10.  
  11.     The differences are minor. From newest to oldest:
  12.  
  13.     Main Set: 16Kbit ROMs
  14.               Green/Hollow empty fuel bar.
  15.               60 points for every bomb destroyed.
  16.  
  17.     Set 2:    8Kbit ROMs
  18.               Blue/Solid empty fuel bar.
  19.               60 points for every bomb destroyed.
  20.  
  21.     Set 3:    8Kbit ROMs
  22.               Blue/Solid empty fuel bar.
  23.               300 points for every seven bombs destroyed.
  24.  
  25.  
  26. To Do!!
  27.        Figure out the correct vblank interval. The one I'm using seems to be
  28.        ok for Astro Fighter, but the submarine in Tomahawk flickers.
  29.        Maybe the video rate should 57FPS as the Burger Time games?
  30.  
  31.        Rotation Support
  32.  
  33. Also....
  34.         I know there must be at least one other rom set for Astro Fighter
  35.         I have played one that stoped between waves to show the next enemy
  36. */
  37.  
  38. #include "driver.h"
  39. #include "vidhrdw/generic.h"
  40.  
  41. extern unsigned char *astrof_color;
  42. extern unsigned char *tomahawk_protection;
  43.  
  44. void astrof_vh_convert_color_prom(unsigned char *palette, unsigned short *colortable,const unsigned char *color_prom);
  45. int  astrof_vh_start(void);
  46. void astrof_vh_stop(void);
  47. void astrof_vh_screenrefresh(struct osd_bitmap *bitmap,int full_refresh);
  48. WRITE_HANDLER( astrof_videoram_w );
  49. WRITE_HANDLER( tomahawk_videoram_w );
  50. WRITE_HANDLER( astrof_video_control1_w );
  51. WRITE_HANDLER( astrof_video_control2_w );
  52. WRITE_HANDLER( tomahawk_video_control2_w );
  53. READ_HANDLER( tomahawk_protection_r );
  54. WRITE_HANDLER( astrof_sample1_w );
  55. WRITE_HANDLER( astrof_sample2_w );
  56.  
  57. extern struct Samplesinterface astrof_samples_interface;
  58. extern struct Samplesinterface tomahawk_samples_interface;
  59.  
  60. static struct MemoryReadAddress readmem[] =
  61. {
  62.     { 0x0000, 0x03ff, MRA_RAM },
  63.     { 0x4000, 0x5fff, MRA_RAM },
  64.     { 0xa000, 0xa000, input_port_0_r },
  65.     { 0xa001, 0xa001, input_port_1_r },    /* IN1 */
  66.     { 0xa003, 0xa003, tomahawk_protection_r },   // Only on Tomahawk
  67.     { 0xd000, 0xffff, MRA_ROM },
  68.     { -1 }    /* end of table */
  69. };
  70.  
  71. static struct MemoryWriteAddress astrof_writemem[] =
  72. {
  73.     { 0x0000, 0x03ff, MWA_RAM },
  74.     { 0x4000, 0x5fff, astrof_videoram_w, &videoram, &videoram_size },
  75.     { 0x8003, 0x8003, MWA_RAM, &astrof_color },
  76.     { 0x8004, 0x8004, astrof_video_control1_w },
  77.     { 0x8005, 0x8005, astrof_video_control2_w },
  78.     { 0x8006, 0x8006, astrof_sample1_w },
  79.     { 0x8007, 0x8007, astrof_sample2_w },
  80.     { -1 }    /* end of table */
  81. };
  82.  
  83. static struct MemoryWriteAddress tomahawk_writemem[] =
  84. {
  85.     { 0x0000, 0x03ff, MWA_RAM },
  86.     { 0x4000, 0x5fff, tomahawk_videoram_w, &videoram, &videoram_size },
  87.     { 0x8003, 0x8003, MWA_RAM, &astrof_color },
  88.     { 0x8004, 0x8004, astrof_video_control1_w },
  89.     { 0x8005, 0x8005, tomahawk_video_control2_w },
  90.     { 0x8006, 0x8006, MWA_NOP },                        // Sound triggers
  91.     { 0x8007, 0x8007, MWA_RAM, &tomahawk_protection },
  92.     { -1 }    /* end of table */
  93. };
  94.  
  95.  
  96.  
  97. /***************************************************************************
  98.  
  99.   These games don't have VBlank interrupts.
  100.   Interrupts are still used by the game: but they are related to coin
  101.   slots.
  102.  
  103. ***************************************************************************/
  104. static int astrof_interrupt(void)
  105. {
  106.     if (readinputport(2) & 1)    /* Coin */
  107.         return nmi_interrupt();
  108.     else return ignore_interrupt();
  109. }
  110.  
  111.  
  112. INPUT_PORTS_START( astrof )
  113.     PORT_START    /* IN0 */
  114.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START1 )
  115.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_START2 )
  116. /* Player 1 Controls */
  117.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_2WAY )
  118.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT  | IPF_2WAY )
  119.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 )
  120. /* Player 2 Controls */
  121.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_2WAY | IPF_COCKTAIL )
  122.     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT  | IPF_2WAY | IPF_COCKTAIL )
  123.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_COCKTAIL )
  124.  
  125.     PORT_START      /* DSW0 */
  126.     PORT_DIPNAME( 0x03, 0x00, DEF_STR( Lives ) )
  127.     PORT_DIPSETTING(    0x00, "3" )
  128.     PORT_DIPSETTING(    0x01, "4" )
  129.     PORT_DIPSETTING(    0x02, "5" )
  130.     PORT_DIPSETTING(    0x03, "6" )
  131.  
  132.     PORT_DIPNAME( 0x0c, 0x00, DEF_STR( Coinage ) )
  133.     PORT_DIPSETTING(    0x08, DEF_STR( 2C_1C ) )
  134.     PORT_DIPSETTING(    0x00, DEF_STR( 1C_1C ) )
  135.     PORT_DIPSETTING(    0x04, DEF_STR( 1C_2C ) )
  136. /* 0x0c gives 2 Coins/1 Credit */
  137.  
  138.     PORT_DIPNAME( 0x30, 0x00, DEF_STR( Bonus_Life ) )
  139.     PORT_DIPSETTING(    0x00, "3000" )
  140.     PORT_DIPSETTING(    0x10, "5000" )
  141.     PORT_DIPSETTING(    0x20, "7000" )
  142.     PORT_DIPSETTING(    0x30, "None" )
  143.  
  144.     PORT_DIPNAME( 0x40, 0x00, DEF_STR( Difficulty ) )
  145.     PORT_DIPSETTING(    0x00, "Easy" )
  146.     PORT_DIPSETTING(    0x40, "Hard" )
  147.  
  148.     PORT_BIT ( 0x80, IP_ACTIVE_LOW, IPT_VBLANK )
  149.  
  150.     PORT_START    /* FAKE */
  151.     /* The coin slots are not memory mapped. Coin insertion causes a NMI. */
  152.     /* This fake input port is used by the interrupt */
  153.     /* handler to be notified of coin insertions. We use IMPULSE to */
  154.     /* trigger exactly one interrupt, without having to check when the */
  155.     /* user releases the key. */
  156.     /* The cabinet selector is not memory mapped, but just disables the */
  157.     /* screen flip logic */
  158.     PORT_BIT_IMPULSE( 0x01, IP_ACTIVE_HIGH, IPT_COIN1, 1 )
  159.     PORT_DIPNAME( 0x02, 0x00, DEF_STR( Cabinet ) )
  160.     PORT_DIPSETTING(    0x00, DEF_STR( Upright ) )
  161.     PORT_DIPSETTING(    0x02, DEF_STR( Cocktail ) )
  162. INPUT_PORTS_END
  163.  
  164.  
  165. INPUT_PORTS_START( tomahawk )
  166.     PORT_START    /* IN0 */
  167.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_4WAY )
  168.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT  | IPF_4WAY )
  169.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN  | IPF_4WAY )
  170.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_UP    | IPF_4WAY )
  171.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 )
  172.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_START1 )
  173.     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_START2 )
  174.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
  175.  
  176.     PORT_START      /* DSW0 */
  177.     PORT_DIPNAME( 0x03, 0x00, DEF_STR( Lives ) )
  178.     PORT_DIPSETTING(    0x00, "3" )
  179.     PORT_DIPSETTING(    0x01, "4" )
  180.     PORT_DIPSETTING(    0x02, "5" )
  181.     PORT_DIPSETTING(    0x03, "6" )
  182.  
  183.     PORT_DIPNAME( 0x0c, 0x00, DEF_STR( Coinage ) )
  184.     PORT_DIPSETTING(    0x08, DEF_STR( 2C_1C ) )
  185.     PORT_DIPSETTING(    0x00, DEF_STR( 1C_1C ) )
  186.     PORT_DIPSETTING(    0x04, DEF_STR( 1C_2C ) )
  187. /* 0x0c gives 2 Coins/1 Credit */
  188.  
  189.     PORT_DIPNAME( 0x30, 0x00, DEF_STR( Bonus_Life ) )
  190.     PORT_DIPSETTING(    0x00, "5000" )
  191.     PORT_DIPSETTING(    0x10, "7000" )
  192.     PORT_DIPSETTING(    0x20, "10000" )
  193.     PORT_DIPSETTING(    0x30, "None" )
  194.  
  195.     PORT_DIPNAME( 0x40, 0x00, DEF_STR( Difficulty ) )  /* Only on Tomahawk 777 */
  196.     PORT_DIPSETTING(    0x00, "Easy" )
  197.     PORT_DIPSETTING(    0x40, "Hard" )
  198.  
  199.     PORT_BIT ( 0x80, IP_ACTIVE_LOW, IPT_VBLANK )
  200.  
  201.     PORT_START    /* FAKE */
  202.     /* The coin slots are not memory mapped. Coin insertion causes a NMI. */
  203.     /* This fake input port is used by the interrupt */
  204.     /* handler to be notified of coin insertions. We use IMPULSE to */
  205.     /* trigger exactly one interrupt, without having to check when the */
  206.     /* user releases the key. */
  207.     /* The cabinet selector is not memory mapped, but just disables the */
  208.     /* screen flip logic */
  209.     PORT_BIT_IMPULSE( 0x01, IP_ACTIVE_HIGH, IPT_COIN1, 1 )
  210.     PORT_DIPNAME( 0x02, 0x00, DEF_STR( Cabinet ) )
  211.     PORT_DIPSETTING(    0x00, DEF_STR( Upright ) )
  212.     PORT_DIPSETTING(    0x02, DEF_STR( Cocktail ) )
  213. INPUT_PORTS_END
  214.  
  215.  
  216. #define MACHINE_DRIVER(GAMENAME, NUMCOLORS)                                    \
  217. static struct MachineDriver machine_driver_##GAMENAME =                           \
  218. {                                                                               \
  219.     /* basic machine hardware */                                               \
  220.     {                                                                           \
  221.         {                                                                       \
  222.             CPU_M6502,                                                           \
  223.             10595000/16,    /* 0.66 Mhz */                                       \
  224.             readmem,GAMENAME##_writemem,0,0,                                   \
  225.             astrof_interrupt,1                                                   \
  226.         }                                                                       \
  227.     },                                                                           \
  228.     60, 3400,    /* frames per second, vblank duration */                       \
  229.     1,    /* single CPU, no need for interleaving */                               \
  230.     0,                                                                           \
  231.                                                                                \
  232.     /* video hardware */                                                       \
  233.     256, 256,                               /* screen_width, screen_height */  \
  234.     { 8, 256-1-8, 8, 256-1-8 },             /* struct rectangle visible_area */\
  235.                                                                                \
  236.     0,    /* no gfxdecodeinfo - bitmapped display */                               \
  237.     NUMCOLORS, 0,                                                               \
  238.     astrof_vh_convert_color_prom,                                               \
  239.                                                                                \
  240.     VIDEO_TYPE_RASTER | VIDEO_MODIFIES_PALETTE,                                   \
  241.     0,                                                                           \
  242.     astrof_vh_start,                                                           \
  243.     astrof_vh_stop,                                                               \
  244.     astrof_vh_screenrefresh,                                                   \
  245.                                                                                \
  246.     /* sound hardware */                                                       \
  247.     0, 0, 0, 0,                                                                   \
  248.     {                                                                            \
  249.         {                                                                       \
  250.             SOUND_SAMPLES,                                                        \
  251.             &GAMENAME##_samples_interface                                        \
  252.         }                                                                       \
  253.     }                                                                           \
  254. };
  255.  
  256. MACHINE_DRIVER(astrof,   16)
  257. MACHINE_DRIVER(tomahawk, 32)
  258.  
  259.  
  260.  
  261. /***************************************************************************
  262.  
  263.   Game driver(s)
  264.  
  265. ***************************************************************************/
  266.  
  267. ROM_START( astrof )
  268.     ROM_REGION( 0x10000, REGION_CPU1 )    /* 64k for code */
  269.     ROM_LOAD( "afii.6",       0xd000, 0x0800, 0xd6cd13a4 )
  270.     ROM_LOAD( "afii.5",       0xd800, 0x0800, 0x6fd3c4df )
  271.     ROM_LOAD( "afii.4",       0xe000, 0x0800, 0x9612dae3 )
  272.     ROM_LOAD( "afii.3",       0xe800, 0x0800, 0x5a0fef42 )
  273.     ROM_LOAD( "afii.2",       0xf000, 0x0800, 0x69f8a4fc )
  274.     ROM_LOAD( "afii.1",       0xf800, 0x0800, 0x322c09d2 )
  275.  
  276.     ROM_REGION( 0x0020, REGION_PROMS )
  277.     ROM_LOAD( "astrf.clr",    0x0000, 0x0020, 0x61329fd1 )
  278. ROM_END
  279.  
  280. ROM_START( astrof2 )
  281.     ROM_REGION( 0x10000, REGION_CPU1 )    /* 64k for code */
  282.     ROM_LOAD( "kei2",         0xd000, 0x0400, 0x9f0bd355 )
  283.     ROM_LOAD( "keii",         0xd400, 0x0400, 0x71f229f0 )
  284.     ROM_LOAD( "kei0",         0xd800, 0x0400, 0x88114f7c )
  285.     ROM_LOAD( "af579.08",     0xdc00, 0x0400, 0x9793c124 )
  286.     ROM_LOAD( "ke8",          0xe000, 0x0400, 0x08e44b12 )
  287.     ROM_LOAD( "ke7",          0xe400, 0x0400, 0x8a42d62c )
  288.     ROM_LOAD( "ke6",          0xe800, 0x0400, 0x3e9aa743 )
  289.     ROM_LOAD( "ke5",          0xec00, 0x0400, 0x712a4557 )
  290.     ROM_LOAD( "ke4",          0xf000, 0x0400, 0xad06f306 )
  291.     ROM_LOAD( "ke3",          0xf400, 0x0400, 0x680b91b4 )
  292.     ROM_LOAD( "ke2",          0xf800, 0x0400, 0x2c4cab1a )
  293.     ROM_LOAD( "af583.00",     0xfc00, 0x0400, 0xf699dda3 )
  294.  
  295.     ROM_REGION( 0x0020, REGION_PROMS )
  296.     ROM_LOAD( "astrf.clr",    0x0000, 0x0020, 0x61329fd1 )
  297. ROM_END
  298.  
  299. ROM_START( astrof3 )
  300.     ROM_REGION( 0x10000, REGION_CPU1 )    /* 64k for code */
  301.     ROM_LOAD( "kei2",         0xd000, 0x0400, 0x9f0bd355 )
  302.     ROM_LOAD( "keii",         0xd400, 0x0400, 0x71f229f0 )
  303.     ROM_LOAD( "kei0",         0xd800, 0x0400, 0x88114f7c )
  304.     ROM_LOAD( "ke9",          0xdc00, 0x0400, 0x29cbaea6 )
  305.     ROM_LOAD( "ke8",          0xe000, 0x0400, 0x08e44b12 )
  306.     ROM_LOAD( "ke7",          0xe400, 0x0400, 0x8a42d62c )
  307.     ROM_LOAD( "ke6",          0xe800, 0x0400, 0x3e9aa743 )
  308.     ROM_LOAD( "ke5",          0xec00, 0x0400, 0x712a4557 )
  309.     ROM_LOAD( "ke4",          0xf000, 0x0400, 0xad06f306 )
  310.     ROM_LOAD( "ke3",          0xf400, 0x0400, 0x680b91b4 )
  311.     ROM_LOAD( "ke2",          0xf800, 0x0400, 0x2c4cab1a )
  312.     ROM_LOAD( "kei",          0xfc00, 0x0400, 0xfce4718d )
  313.  
  314.     ROM_REGION( 0x0020, REGION_PROMS )
  315.     ROM_LOAD( "astrf.clr",    0x0000, 0x0020, 0x61329fd1 )
  316. ROM_END
  317.  
  318. ROM_START( tomahawk )
  319.     ROM_REGION( 0x10000, REGION_CPU1 )    /* 64k for code */
  320.     ROM_LOAD( "l8-1",         0xdc00, 0x0400, 0x7c911661 )
  321.     ROM_LOAD( "l7-1",         0xe000, 0x0400, 0xadeffb69 )
  322.     ROM_LOAD( "l6-1",         0xe400, 0x0400, 0x9116e59d )
  323.     ROM_LOAD( "l5-1",         0xe800, 0x0400, 0x01e4c7c4 )
  324.     ROM_LOAD( "l4-1",         0xec00, 0x0400, 0xd9f69cb0 )
  325.     ROM_LOAD( "l3-1",         0xf000, 0x0400, 0x7ce7183f )
  326.     ROM_LOAD( "l2-1",         0xf400, 0x0400, 0x43fea29d )
  327.     ROM_LOAD( "l1-1",         0xf800, 0x0400, 0xf2096ba9 )
  328.     ROM_LOAD( "l0-1",         0xfc00, 0x0400, 0x42edbc28 )
  329.  
  330.     ROM_REGION( 0x0020, REGION_PROMS )
  331.     ROM_LOAD( "t777.clr",     0x0000, 0x0020, 0xd6a528fd )
  332. ROM_END
  333.  
  334. ROM_START( tomahaw5 )
  335.     ROM_REGION( 0x10000, REGION_CPU1 )    /* 64k for code */
  336.     ROM_LOAD( "thawk.l8",     0xdc00, 0x0400, 0xb01dab4b )
  337.     ROM_LOAD( "thawk.l7",     0xe000, 0x0400, 0x3a6549e8 )
  338.     ROM_LOAD( "thawk.l6",     0xe400, 0x0400, 0x863e47f7 )
  339.     ROM_LOAD( "thawk.l5",     0xe800, 0x0400, 0xde0183bc )
  340.     ROM_LOAD( "thawk.l4",     0xec00, 0x0400, 0x11e9c7ea )
  341.     ROM_LOAD( "thawk.l3",     0xf000, 0x0400, 0xec44d388 )
  342.     ROM_LOAD( "thawk.l2",     0xf400, 0x0400, 0xdc0a0f54 )
  343.     ROM_LOAD( "thawk.l1",     0xf800, 0x0400, 0x1d9dab9c )
  344.     ROM_LOAD( "thawk.l0",     0xfc00, 0x0400, 0xd21a1eba )
  345.  
  346.     ROM_REGION( 0x0020, REGION_PROMS )
  347.     ROM_LOAD( "t777.clr",     0x0000, 0x0020, 0xd6a528fd )
  348. ROM_END
  349.  
  350.  
  351.  
  352. GAME( 1980, astrof,   0,        astrof,   astrof,   0, ROT90, "Data East", "Astro Fighter (set 1)" )
  353. GAME( 1980, astrof2,  astrof,   astrof,   astrof,   0, ROT90, "Data East", "Astro Fighter (set 2)" )
  354. GAME( 1980, astrof3,  astrof,   astrof,   astrof,   0, ROT90, "Data East", "Astro Fighter (set 3)" )
  355. GAME( 1980, tomahawk, 0,        tomahawk, tomahawk, 0, ROT90, "Data East", "Tomahawk 777 (Revision 1)" )
  356. GAME( 1980, tomahaw5, tomahawk, tomahawk, tomahawk, 0, ROT90, "Data East", "Tomahawk 777 (Revision 5)" )
  357.